#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "Element.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class InstanceSpecification;
class StructuralFeature;
class ValueSpecification;

/// <summary>
/// Slot
/// A Slot designates that an entity modeled by an InstanceSpecification has a value
/// or values for a specific StructuralFeature.
/// </summary>
class UMLMODEL_EXPORT Slot : public Element {

public: // Constructors and destructors
    explicit Slot(const QString& umlType="uml::Slot");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// definingFeature getter
    /// The StructuralFeature that specifies the values that may be held by the Slot.
    /// </summary>
    shared_ptr<StructuralFeature> definingFeature() const;

    /// <summary>
    /// definingFeature setter
    /// The StructuralFeature that specifies the values that may be held by the Slot.
    /// </summary>
    void setDefiningFeature(shared_ptr<StructuralFeature> value);

    /// <summary>
    /// owningInstance getter
    /// The InstanceSpecification that owns this Slot.
    /// </summary>
    shared_ptr<InstanceSpecification> owningInstance() const;

    /// <summary>
    /// owningInstance setter
    /// The InstanceSpecification that owns this Slot.
    /// </summary>
    void setOwningInstance(shared_ptr<InstanceSpecification> value);

    /// <summary>
    /// values getter
    /// The value or values held by the Slot.
    /// </summary>
    vector<shared_ptr<ValueSpecification>>& values();

private: // Fields
    /// <summary>
    /// definingFeature
    /// The StructuralFeature that specifies the values that may be held by the Slot.
    /// </summary>
    shared_ptr<StructuralFeature> definingFeature_;

    /// <summary>
    /// owningInstance
    /// The InstanceSpecification that owns this Slot.
    /// </summary>
    shared_ptr<InstanceSpecification> owningInstance_;

    /// <summary>
    /// values
    /// The value or values held by the Slot.
    /// </summary>
    vector<shared_ptr<ValueSpecification>> values_;

};

} // namespace uml
